package com.example.smart_community.controller;

import com.example.smart_community.model.MessageModel;
import com.example.smart_community.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;
    @GetMapping("/login")
    public MessageModel login(String username, String userpass){
        return userService.login(username, userpass);
    }
    @GetMapping("/register")
    public MessageModel register(String username,String userpass,String suserpass){
        return userService.register(username, userpass, suserpass);
    }
    @GetMapping("/modify")
    public MessageModel modify(String username, String userpass,String newpass){
        return userService.modify(username, userpass, newpass);
    }
    @GetMapping("/logout")
    public MessageModel logout(String username,String userpass){
        return userService.logout(username, userpass);
    }
}
